System and method for supporting smart buffer management in a distributed data grid

ABSTRACT

A system and method can support smart buffer management in a distributed data grid. A buffer manager in the distributed data grid can provide a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects. The buffer manager can prevent a garbage collector from directly recycling the memory associated with each individual object in the buffer pool, and can allow the garbage collecting of one or more objects in one or more buffers in a particular generation to be performed together.

CLAIM OF PRIORITY

This application claims priority on U.S. Provisional Patent Application No. 61/714,100, entitled “SYSTEM AND METHOD FOR SUPPORTING A DISTRIBUTED DATA GRID IN A MIDDLEWARE ENVIRONMENT,” by inventors Robert H. Lee, Gene Gleyzer, Charlie Helin, Mark Falco, Ballav Bihani and Jason Howes, filed Oct. 15, 2012, which application is herein incorporated by reference.

CROSS-REFERENCED APPLICATIONS

The current application hereby incorporates by reference the material in the following patent applications:

U.S. patent application Ser. No. ______, titled “SYSTEM AND METHOD FOR PROVIDING A FLEXIBLE BUFFER MANAGEMENT INTERFACE IN A DISTRIBUTED DATA GRID”, inventors Charlie Helin, and Mark Falco, filed ______ (Attorney Docket No.: ORACL-05361 US0).

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains material which is subject to copyright protection. The copyright owner has no objection to the facsimile reproduction by anyone of the patent document or the patent disclosure, as it appears in the Patent and Trademark Office patent file or records, but otherwise reserves all copyright rights whatsoever.

FIELD OF INVENTION

The present invention is generally related to computer systems, and is particularly related to a distributed data grid.

BACKGROUND

Modern computing systems, particularly those employed by larger organizations and enterprises, continue to increase in size and complexity. Particularly, in areas such as Internet applications, there is an expectation that millions of users should be able to simultaneously access that application, which effectively leads to an exponential increase in the amount of content generated and consumed by users, and transactions involving that content. Such activity also results in a corresponding increase in the number of transaction calls to databases and metadata stores, which have a limited capacity to accommodate that demand.

This is the general area that embodiments of the invention are intended to address.

SUMMARY

Described herein is a system and method that can support smart buffer management in a distributed data grid. A buffer manager in the distributed data grid can provide a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects. The buffer manager can prevent a garbage collector from directly recycling the memory associated with each individual object in the buffer pool, and can allow the garbage collecting of one or more objects in one or more buffers in a particular generation to be performed together

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 is an illustration of a data grid cluster in accordance with various embodiments of the invention.

FIG. 2 shows an illustration of supporting smart buffer management in a data grid cluster, in accordance with an embodiment of the invention.

FIG. 3 illustrates an exemplary flow chart for supporting smart buffer management in a data grid cluster, in accordance with an embodiment of the invention.

DETAILED DESCRIPTION

Described herein is a system and method that can support smart buffer management in a distributed data grid.

In accordance with an embodiment, as referred to herein a “distributed data grid”, “data grid cluster”, or “data grid”, is a system comprising a plurality of computer servers which work together to manage information and related operations, such as computations, within a distributed or clustered environment. The data grid cluster can be used to manage application objects and data that are shared across the servers. Preferably, a data grid cluster should have low response time, high throughput, predictable scalability, continuous availability and information reliability. As a result of these capabilities, data grid clusters are well suited for use in computational intensive, stateful middle-tier applications. Some examples of data grid clusters, e.g., the Oracle Coherence data grid cluster, can store the information in-memory to achieve higher performance, and can employ redundancy in keeping copies of that information synchronized across multiple servers, thus ensuring resiliency of the system and the availability of the data in the event of server failure. For example, Coherence provides replicated and distributed (partitioned) data management and caching services on top of a reliable, highly scalable peer-to-peer clustering protocol.

An in-memory data grid can provide the data storage and management capabilities by distributing data over a number of servers working together. The data grid can be middleware that runs in the same tier as an application server or within an application server. It can provide management and processing of data and can also push the processing to where the data is located in the grid. In addition, the in-memory data grid can eliminate single points of failure by automatically and transparently failing over and redistributing its clustered data management services when a server becomes inoperative or is disconnected from the network. When a new server is added, or when a failed server is restarted, it can automatically join the cluster and services can be failed back over to it, transparently redistributing the cluster load. The data grid can also include network-level fault tolerance features and transparent soft re-start capability.

In accordance with an embodiment, the functionality of a data grid cluster is based on using different cluster services. The cluster services can include root cluster services, partitioned cache services, and proxy services. Within the data grid cluster, each cluster node can participate in a number of cluster services, both in terms of providing and consuming the cluster services. Each cluster service has a service name that uniquely identifies the service within the data grid cluster, and a service type, which defines what the cluster service can do. Other than the root cluster service running on each cluster node in the data grid cluster, there may be multiple named instances of each service type. The services can be either configured by the user, or provided by the data grid cluster as a default set of services.

FIG. 1 is an illustration of a data grid cluster in accordance with various embodiments of the invention. As shown in FIG. 1, a data grid cluster 100, e.g. an Oracle Coherence data grid, includes a plurality of cluster nodes 101-106 having various cluster services 111-116 running thereon. Additionally, a cache configuration file 110 can be used to configure the data grid cluster 100.

Smart Buffer Management

In accordance with an embodiment of the invention, the distributed data grid supports smart buffer management that can be beneficial for data grid operations, such as supporting object serialization and network input/output (I/O) for various applications.

FIG. 2 shows an illustration of supporting smart buffer management in a data grid cluster, in accordance with an embodiment of the invention. As shown in FIG. 2, a data grid cluster 200 can use a buffer manager 201 to manage a buffer pool 210.

The buffer pool 210 contains a plurality of buffers, each of which can contain one or more objects for one or more applications 202. Each buffer can be a shared buffer that holds a byte buffer data structure, and the shared buffer can be released back to the buffer manager 201 when a reference count reaches zero.

Furthermore, the plurality of buffers can be arranged in different generations, e.g. from generation 0 to generation N. Also, within each generation, there can be multiple segments, e.g. Segment A to Segment C. The buffer manager 201 can manage the buffers in the buffer pool 210 based on the generation concept, i.e. the buffer manager 201 can allocate or release memory for the buffers in a particular generation at the same time.

For example, the buffer manager 201 can initially create a buffer pool 210 with no buffer. When the buffer manager 201 receives a first request for a buffer from a requester, e.g. application 202, the buffer manager 201 can allocate a portion of the memory, e.g. 10% of the total memory under the buffer pool 210, for creating the generation 0 buffers in one operation. Then, the buffer manager 201 can create a generation 0 buffer from the allocated memory and return the allocated buffer to the requester. Thus, the memory for buffers in a same generation can be kept close (addresswise) to each other in the memory.

Furthermore, in order to serve the incoming buffer requests, the buffer manager 201 can allocate buffers in a new generation before reaching the maximum limit for the buffer pool 210, if all the current generations are full.

Additionally, the buffer pool 210 can prevent a garbage collector 203 from directly recycling memory associated with each individual object in the buffer pool 210. The buffer pool 210 can be beneficial for handling large objects with medium length life cycle, e.g. in the tenured space of JAVA heap.

On the other hand, the garbage collectors 203 are preferable for handling small objects with short life cycle. For example, the garbage collector 203 may treat the objects with medium length life cycle as permanent objects. The garbage collector 203 may only try to recycle the memory for the objects with medium length life cycle at the time when a full garbage collection operation is performed. Thus, the memory usage may become inefficient since these objects can become garbage sooner than a full garbage collection operation is performed.

Also, from the perspective of a garbage collector 203, the objects in the buffer pool 210 are garbage collection friendly, since there are generally a limited number of large objects in the buffer pool 210, and the memory for these objects are close (addresswise) to each other. Additionally, these objects are terminal objects that do not reference other objects.

In accordance with an embodiment of the invention, the system allows the garbage collector 203 to recycle the memory allocated for the buffers in different generations according to seniority, or the generation number. For example, the buffer pool 210 can allow the garbage collector 203 to first recycle memory for one or more buffers in the youngest generation, when the pool reaches a limit. One reason is that the memory associated with the older generation buffers may have already been defragmented, thus, tends to be more garbage collection friendly.

Furthermore, buffers in a particular generation, e.g. generation 15 in Coherence, can be non-pooled buffers. Each non-pooled buffer can be created separately upon request and may be garbage collected as soon as it is dereferenced in the application 202. Additionally, when the buffer pool 210 reaches its limit, the buffer pool 210 can automatically looks for the non-pooled buffers and try to garbage collect them if possible.

Each individual buffer can be implemented based on a standard byte buffer or byte array defined in an object oriented programming language, e.g. JAVA. The system can use the size of a buffer, e.g. the last two digit of the size number, as an implicit generation identifier that indicates which generation the buffer is in. For example, the system can allocate a chunk of memory with 1024 K bytes for generation 0 buffers, a chunk of memory with 1025 K bytes for generation 1 buffers, and a chunk of memory with 1026 K bytes for generation 2 buffers.

In accordance with an embodiment of the invention, the plurality of buffers can also be arranged in different segments, with different buffers in a same segment having a same size. For example, the system can create the buffers in small, medium, and large segments. Thus, the buffer manager 201 can provide a suitable buffer in a particular segment, e.g. a buffer in segment B in generation 1, according to the need of the requester 202.

Within each segment, there can be different queues, each of which can be associated with a different thread. For example, there can be 24 queues in each segment for a distributed data grid running on a 24 core machine. Thus, the buffer pool 210 can be accessed and managed concurrently via the different queues on different threads.

FIG. 3 illustrates an exemplary flow chart for supporting smart buffer management in a data grid cluster, in accordance with an embodiment of the invention. As shown in FIG. 3, at step 301, a buffer manager can provide a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects. Furthermore, at step 302, the buffer pool can prevent a garbage collector from directly recycling memory associated with each individual object in the buffer pool. Then, at step 302, the buffer pool allows the garbage collecting of one or more objects in one or more buffers in a particular generation to be performed together.

The present invention may be conveniently implemented using one or more conventional general purpose or specialized digital computer, computing device, machine, or microprocessor, including one or more processors, memory and/or computer readable storage media programmed according to the teachings of the present disclosure. Appropriate software coding can readily be prepared by skilled programmers based on the teachings of the present disclosure, as will be apparent to those skilled in the software art.

In some embodiments, the present invention includes a computer program product which is a storage medium or computer readable medium (media) having instructions stored thereon/in which can be used to program a computer to perform any of the processes of the present invention. The storage medium can include, but is not limited to, any type of disk including floppy disks, optical discs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs, EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or optical cards, nanosystems (including molecular memory ICs), or any type of media or device suitable for storing instructions and/or data.

The foregoing description of the present invention has been provided for the purposes of illustration and description. It is not intended to be exhaustive or to limit the invention to the precise forms disclosed. Many modifications and variations will be apparent to the practitioner skilled in the art. The embodiments were chosen and described in order to best explain the principles of the invention and its practical application, thereby enabling others skilled in the art to understand the invention for various embodiments and with various modifications that are suited to the particular use contemplated. It is intended that the scope of the invention be defined by the following claims and their equivalence. 

What is claimed is:
 1. A method for managing buffers in a distributed data grid, comprising: providing, via a buffer manager, a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects; preventing a garbage collector from directly recycling memory associated with each individual object in the buffer pool; and performing garbage collecting of one or more objects in one or more buffers in a particular generation together.
 2. The method according to claim 1, further comprising: implementing each individual buffer based on a standard byte buffer defined in an object oriented programming language.
 3. The method according to claim 2, further comprising: using a size of a buffer as an implicit generation identifier that indicates which generation the buffer is in.
 4. The method according to claim 1, further comprising: allocating memory for one or more buffers in a particular generation together.
 5. The method according to claim 1, further comprising: allowing the garbage collector to first recycle memory for one or more objects in one or more buffers in a youngest generation when the buffer pool reaches limit.
 6. The method according to claim 1, further comprising: allowing the garbage collector to recycle memory for one or more objects in one or more buffers in a generation according to seniority.
 7. The method according to claim 1, further comprising: using one or more buffers in the buffer pool in the distributed data grid to support at least one of object serialization and network input/output.
 8. The method according to claim 1, further comprising: allowing each buffer to be a shared buffer that holds a byte buffer data structure, wherein the shared buffer is released back to the buffer manager when a reference count reaches zero.
 9. The method according to claim 1, further comprising: allowing the plurality of buffers to be in different segments, wherein each buffer in a segment is associated with a designated size.
 10. The method according to claim 9, further comprising: allowing the one or more buffers in each generation to be categorized in small, medium, and large segment.
 11. A system for managing buffers in a distributed data grid, comprising: one or more microprocessors; a buffer manager in the distributed data grid running on the one or more microprocessors, wherein the buffer manager operates to perform the steps of providing, via a buffer manager, a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects; preventing a garbage collector from directly recycling memory associated with each individual object in the pool; and performing garbage collecting of one or more objects in one or more buffers in a particular generation together.
 12. The system according to claim 11, wherein: implementing each individual buffer based on a standard byte buffer defined in an object oriented programming language.
 13. The system according to claim 12, wherein: a size of a buffer is used as an implicit generation identifier that indicates which generation the buffer is in.
 14. The system according to claim 11, wherein: the buffer manager operates to allocate memory for one or more buffers in a particular generation together.
 15. The system according to claim 11, wherein: the buffer manager allows the garbage collector to first recycle memory for one or more objects in one or more buffers in a youngest generation when the buffer pool reaches limit.
 16. The system according to claim 11, wherein: the buffer manager allows the garbage collector to recycle memory for one or more objects in one or more buffers in a generation according to seniority.
 17. The system according to claim 11, wherein: one or more buffers in the buffer pool in the distributed data grid are used to support at least one of object serialization and network input/output.
 18. The system according to claim 11, wherein: the buffer manager allows each buffer to be a shared buffer that holds a byte buffer data structure, wherein the shared buffer is released back to the buffer manager when a reference count reaches zero.
 19. The system according to claim 1, further comprising: the buffer manager operates to perform the steps of allowing the plurality of buffers to be in different segments, wherein each buffer in a segment is associated with a designated size, and allowing the one or more buffers in each generation to be categorized in small, medium, and large segment.
 20. A non-transitory machine readable storage medium having instructions stored thereon that when executed cause a system to perform the steps of: providing, via a buffer manager, a plurality of buffers in a buffer pool in the distributed data grid, wherein the plurality of buffers are arranged in different generations and each buffer operates to contain one or more objects; preventing a garbage collector from directly recycling memory associated with each individual object in the pool; and performing garbage collecting of one or more objects in one or more buffers in a particular generation together. 